<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>我的二维码</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0" />
		<!--ios是否运行创建快捷启动方式-->
		<meta content="yes" name="apple-mobile-web-app-capable">
		<!--ios顶部通知栏的样式 黑色-->
		<meta content="black" name="apple-mobile-web-app-status-bar-style">
		<!--遇到数字不让转成电话号码格式-->
		<meta content="telephone=no" name="format-detection">
		<script src="js/remstyle.js"></script>
		<link rel="stylesheet" href="assets/mui/css/mui.min.css">
		<link rel="stylesheet" type="text/css" href="common/css/base.css" />
		<link rel="stylesheet" type="text/css" href="css/min_page.css" />
		<link rel="stylesheet" type="text/css" href="css/sameInfo.css" />
		<link rel="stylesheet" type="text/css" href="css/material_QR_code.css" />
		<script type="text/javascript" src="js/vue.js"></script>
		<script type="application/javascript " src="js/jquery-1.7.2.min.js "></script>
		<script src="layer/layer.js"></script>
		<link rel="stylesheet" type="text/css" href="layer/skin/layer.css" />
		<script src="js/config.js"></script>
	</head>
	<style>
		.phone_bottom {
			position: fixed;
			width: 100%;
			height: 1rem;
			line-height: 1rem;
			background: #fff;
			bottom: 0;
			left: 0;
			display: flex;
			font-size: 0.28rem;
		}
		
		.phone_bottom button {
			width: 50%;
			height: 1rem;
			line-height: 1rem;
			border-radius: inherit;
			border: none;
		}
		
		.phone_bottom button:first-child {
			border-top: 1px solid #707070;
			color: #1f8ff3;
		}
		
		.phone_bottom button:last-child {
			background: #1f8ff3;
			color: #fff;
		}
	</style>

	<body>
		<!--顶部-->
		<div class="top">
			<div class="top-one" onclick="javascript :history.back(-1);">
				<span><img src="img_page/right.png"/></span>
			</div>
			<div class="point">
				<img src="img_page/3point.png" />
			</div>
		</div>
		<!--内容-->
		<div class="my_code_list" style="margin-bottom: 1.2rem;">
			<div class="code_con" v-for="v in code_list">
				<div class="code_list" v-if="v.template==0" @click="choose_my_code($event,v.template)">
					<img class="code_list_img" src="img_page/code_bgp.png" />
					<img class="code_list_qr" :src="v.url" />
				</div>
				<div class="code_list_a" v-if="v.template==1" @click="choose_my_code($event,v.template)">
					<div style="position: relative;">
						<img class="code_list_img" src="img_page/code_bgp2.png" />
						<img class="code_list_qr_a" :src="v.url" />
					</div>

				</div>
			</div>

		</div>

		<!--底部-->
		<div class="phone_bottom">
			<button onclick="phone_manage()">管理</button>
			<button onclick="new_phone()">新建二维码</button>
		</div>
	</body>
	<script type="text/javascript">
		var aaaa = window.location.href;
		var bbbb = aaaa.substring(aaaa.indexOf('addToTo=') + 8,aaaa.length);
		var code_list = new Vue({
			el: '.my_code_list',
			data: {
				code_list: []
			},
			created: function() {
				this.getList();
			},
			methods: {
				getList: function() {
					console.log("11111");
					var that = this;
					$.ajax({
						type: "get",
						url: v_url + "/wechat/material/getWxQrList",
						data: {
							c_user_id: c_user_id
						},
						async: true,
						success: function(res) {
							var list = res.data;
							that.code_list = list;
							console.log(list);
						}
					});

				},
				choose_my_code: function(obj, template) {
					console.log(v_param)
					var html = ''
					if(template == 0) {
						html = "<div class='code_list'>" + $(obj.currentTarget).html() + "</div>"
					} else {
						html = "<div class='code_list_a'>" + $(obj.currentTarget).html() + "</div>"
					}

					if(v_param) {
						$.ajax({
							type: "get",
							url: v_url + "/wechat/singlepage/saveContent",
							data: {
								id: v_param,
								content: html,
								c_user_id: c_user_id
							},
							async: false,
							success: function(res) {
								if(res.code == 200) {
									console.log("保存成功")
									window.location.href = bbbb;
								} else {
									console.log("保存失败")
								}
							}
						});
					}
				}
			}
		})

		function phone_manage() {
			window.location.href = 'material_QR_code_del.html?c_user_id=' + c_user_id
		}

		function new_phone() {
			window.location.href = 'material_QR_code_template.html?c_user_id=' + c_user_id
		}
	</script>

</html>